﻿Public Class Animaux

    ''' <summary>
    ''' Propriete retournant la race de l'animal
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property race() As String
        Get
            Me.RacesReference.Load()
            Return Me.Races.Race
        End Get
    End Property

    ''' <summary>
    ''' Propriete retournant l'espece de l'animal
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property espece() As String
        Get
            Me.RacesReference.Load()
            Return Me.Races.Espece
        End Get
    End Property

    Public Property consultation() As List(Of Consultations)
        Get
            Me.Consultations.Load()
            Return Me.Consultations.ToList
        End Get
        Set(ByVal value As List(Of Consultations))
        End Set
    End Property

    ''' <summary>
    ''' Fonction tostring qui renvoie le nom de l'animal (string)
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Overrides Function ToString() As String
        Return Me.NomAnimal.ToString
    End Function

    ''' <summary>
    ''' Fonction de test qui renvoie un booleen TRUE si le posseseur de l'animal peut etre archiver
    ''' (n'a pas de facture impayée)
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function isMonMaitreArchivable() As Boolean

        isMonMaitreArchivable = False
        Me.ClientsReference.Load()
        If Me.Clients.isClientArchivable Then
            isMonMaitreArchivable = True
        End If

    End Function

    ''' <summary>
    ''' procedure d'archivage de l'animal
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub archiverAnimal()
        'archivage de toute les consultations de l'animal
        Me.Consultations.Load()
        For Each consul In Me.Consultations
            If consul.Archive = False Then
                consul.archiverConsultation()
            End If
        Next
        'archivage de l'animal
        Me.Archive = True

    End Sub

    ''' <summary>
    ''' Procedure de modification de l'animal (nom,couleur,sexe,tatouage)
    ''' </summary>
    ''' <param name="nom"></param>
    ''' <param name="couleur"></param>
    ''' <param name="sexe"></param>
    ''' <param name="tatouage"></param>
    ''' <remarks></remarks>
    Public Sub modifierAnimal(ByVal nom As String, ByVal couleur As String, ByVal sexe As String, ByVal tatouage As String)

        With Me
            .NomAnimal = nom
            .Couleur = couleur
            .Sexe = sexe
            .Tatouage = tatouage
        End With

    End Sub

End Class
